<?php 

namespace App\Models\Cxhshop;

use App\Models\Base\CxhshopBase;

class GoodCategory extends CxhshopBase {

    protected $table = 'ims_ewei_shop_category';

    /**
     * 获取所有分类
     * params1 int type
     */
    public static function getAllCategory($type = 0) {
        $list = self::query() -> whereUniacid(1) -> get(['id', 'name', 'parentid','level']) -> toArray();
        // $list = self::doCategoryLevle($list);
        if($type == 1) {
            $list = getChild($list);
            return $list;
        } 
        return $list;
    }

}